An algorithm for removing inflectional and derivational endings in order to reduce word forms to a common stem